{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np #导入numpy\n",
    "import os\n",
    "from datetime import datetime"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2000-01-01 00:00:00\n",
      "2025-11-02 19:40:22.761086\n",
      "2000\n",
      "1\n",
      "1\n",
      "6\n",
      "Sunday\n"
     ]
    }
   ],
   "source": [
    "date1 = datetime(year=2000, month=1, day=1)\n",
    "date2 = datetime.now()\n",
    "print(date1)# 2000-01-01 00:00:00\n",
    "print(date2)# 2025-01-01 00:00:00\n",
    "print(date1.year)# 2000\n",
    "print(date1.month)# 1\n",
    "print(date1.day)# 1\n",
    "print(date2.weekday())# 5\n",
    "print(date2.strftime(\"%A\"))# Saturday"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2015-01-01 00:00:00\n",
      "DatetimeIndex(['2015-07-04', '2015-07-06', '2015-07-07', '2015-07-08'], dtype='datetime64[ns]', freq=None)\n"
     ]
    }
   ],
   "source": [
    "print(pd.to_datetime(\"2015-01-01\"))\n",
    "print(pd.to_datetime([\"4th of July, 2015\", \"2015-Jul-6\", \"07-07-2015\", \"20150708\"],format=\"mixed\"))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
